package health_system.health_system.service;

import health_system.health_system.dto.*;
import health_system.health_system.entity.MomentComment;
import org.springframework.data.domain.Pageable;

import java.util.List;
import java.util.Optional;

public interface MomentCommentService {
    
    /**
     * Create a new comment
     */
    MomentCommentDTO createComment(MomentCommentCreateDTO createDTO);
    
    /**
     * Update an existing comment
     */
    MomentCommentDTO updateComment(Long id, MomentCommentUpdateDTO updateDTO);
    
    /**
     * Delete a comment
     */
    void deleteComment(Long id);
    
    /**
     * Get a comment by ID
     */
    MomentCommentDTO getCommentById(Long id);
    
    /**
     * Find a comment entity by ID (for internal use)
     */
    MomentComment getCommentEntityById(Long id);
    
    /**
     * Find a comment entity by ID (optional, for internal use)
     */
    Optional<MomentComment> findCommentEntityById(Long id);
    
    /**
     * Get all comments for a moment
     */
    List<MomentCommentDTO> getAllCommentsForMoment(Long momentId);
    
    /**
     * Get paginated comments for a moment
     */
    PageResponseDTO<MomentCommentDTO> getAllCommentsForMoment(Long momentId, Pageable pageable);
    
    /**
     * Get hierarchical comment tree for a moment
     */
    MomentCommentTreeDTO getCommentTreeForMoment(Long momentId);
    
    /**
     * Get all comments by a user
     */
    List<MomentCommentDTO> getAllCommentsByUser(Long userId);
    
    /**
     * Get paginated comments by a user
     */
    PageResponseDTO<MomentCommentDTO> getAllCommentsByUser(Long userId, Pageable pageable);
    
    /**
     * Get all moments commented by a user
     */
    List<MomentDTO> getMomentsCommentedByUser(Long userId);
    
    /**
     * Get paginated moments commented by a user
     */
    PageResponseDTO<MomentDTO> getMomentsCommentedByUser(Long userId, Pageable pageable);
    
    /**
     * Get replies to a comment
     */
    List<MomentCommentDTO> getRepliesForComment(Long commentId);
    
    /**
     * Count comments for a moment
     */
    Long countCommentsForMoment(Long momentId);
    
    /**
     * Count comments by a user
     */
    Long countCommentsByUser(Long userId);
    
    /**
     * Count replies to a comment
     */
    Long countRepliesForComment(Long commentId);
    
    /**
     * Get users who commented on a moment
     */
    List<UserDTO> getUsersWhoCommentedOnMoment(Long momentId);
    
    /**
     * Search comments by content in a moment
     */
    List<MomentCommentDTO> searchCommentsInMoment(Long momentId, String searchTerm);
    
    /**
     * Get comments with most replies in a moment
     */
    List<MomentCommentDTO> getCommentsWithMostReplies(Long momentId, int limit);
    
    /**
     * Find comments mentioning a user
     */
    List<MomentCommentDTO> findCommentsMentioningUser(Long userId, String mention);
    
    /**
     * Get recently commented moments by a user's friends
     */
    List<MomentDTO> getRecentlyCommentedMomentsByFriends(Long userId, int limit);
    
    /**
     * Get moments with most comments visible to a user
     */
    List<MomentDTO> getMomentsWithMostCommentsVisibleToUser(Long userId, int limit);
    
    /**
     * Get comment statistics for a user
     */
    UserCommentStatsDTO getUserCommentStats(Long userId);
    
    /**
     * Get batch of comment details by IDs
     */
    List<MomentCommentDTO> getCommentsByIds(List<Long> commentIds);
} 